package com.java.base.lamda;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class LamdaTest {

    static Class clz;

    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {


        test("a");
        if (clz == null) {
            return;
        }
//        Method[] methods = clz.getDeclaredMethods();
        Method[] methods = clz.getMethods();

        for (Method method : methods) {
            System.out.println(method.getName());
        }
        Method method = LamdaTest.class.getDeclaredMethod("lambda$test$0", String.class);
        method.invoke(null, "f");
    }

    public static void test(String a) {
        run(() -> System.out.println(a));
    }

    public static void run(LamdaI lamdaI) {
        lamdaI.test();
        System.out.println(lamdaI.getClass().getName());
        clz = lamdaI.getClass().getClass();
    }

    public  interface LamdaI{
        public void test();
    }

}
